package com.iims.finance.domain;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.iims.common.core.domain.BussinessEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import javax.persistence.Column;
import javax.validation.constraints.*;
import java.math.BigDecimal;
import java.util.Date;

/**
 * 收入确认
 *
 * @TableName cmis_cw_income_affirm
 */
@TableName(value = "cmis_cw_income_affirm")
@Data
@BussinessEntity
@ApiModel("收入确认")
public class CmisCwIncomeAffirm extends CmisFinanceReview {
    /**
     * 收入确认Id
     */
    @ApiModelProperty(value = "收入确认Id", required = true)
    @TableId(type = IdType.AUTO)
    private Long affirmId;

    /**
     * 合同id
     */
    @ApiModelProperty(value = "正式合同Id,项目隶属于某合同", required = true)
    @Positive(message = "正式合同Id必须有效 >0")
    private Long contractId;

    /**
     * 确认日期
     */
    @ApiModelProperty(value = "确认日期|yyyy-MM-dd", required = true)
    @NotNull(message = "确认日期不能为空")
    @JsonFormat(pattern = "yyyy-MM-dd")
    private Date affirmTime;

    /**
     * 收入确认金额
     */
    @ApiModelProperty(value = "收入确认金额/元:最大12位整数2位小数", required = true)
    @Column(length = 14, scale = 2)
    @Positive(message = "收入确认金额必须有效 >0")
    private BigDecimal incomeMoney;

    /**
     * 确认比例
     */
    @ApiModelProperty(value = "确认比例", allowableValues = "range[1,100]", required = true)
    @Max(100)
    @Min(1)
    private Integer percentage;

    /**
     * 确认人
     */
    @ApiModelProperty(value = "确认人(user_code)", required = true)
    @NotBlank(message = "确认人不能为空")
    private String affirmUser;

    //vo
    /**
     * 寄票人(中文)
     */
    @ApiModelProperty(value = "寄票人(中文)")
    @TableField(exist = false)
    private String affirmUserCN;
}